home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
hity wydania
/
trueSpace 7.6
/
tS761B8Std.exe
/
{app}
/
Scripts
/
ScriptCommands
/
DefaultLibScanner.xml
< prev
next >
Wrap
Extensible Markup Language
|
2008-06-10
|
6KB
|
155 lines
<?xml version="1.0" encoding="utf-8" ?>
<SCRIPT Name="DefaultLibScanner" Type="Command" Language="ScriptObject Package/jScript language" UIName="" Description="default context libs scanner" GUID="{A368C449-5972-4fdd-BE95-BB3BE0700FF2}">
<SCRIPT_PARAM Name="Node Name" Type="string" Direction="In" Description="No description"/>
<SCRIPT_PARAM Name="Dynamic Lib Name" Type="string" Direction="In" Description="No description"/>
<SCRIPT_PARAM Name="LE Frame Name" Type="string" Direction="In" Description="No description"/>
<SCRIPT_PARAM Name="Dynamic Lib WinID" Type="string" Direction="Out" Description="No description"/>
<SCRIPT_PARAM Name="Lib Name" Type="string" Direction="Out" Description="No description"/>
<SCRIPT_CODE><![CDATA[
function Execute(ret)
{
/////////////////////////////////////////////////////////////////
// Default Scanner - creator of dynamic lib toolbar for LE
/////////////////////////////////////////////////////////////////
// obtain input params
// scanned root
nodeName = ret.Param('Node Name');
// parent library name
LibParent = ret.Param('Dynamic Lib Name');
// LE frame for library toolbar
LEFrameName = ret.Param('LE Frame Name');
// created library ( previous name)
oldLibName = ret.Param('Lib Name');
// new library
dynLibName = '';
// skip root node
if (nodeName == '')
return;
if (nodeName.indexOf('/LW Material Editor') != -1)
{
// special case - LWME node, display more libs here
try
{
outlookFrameName = Library.ToggleSubLibraryEx('(/Libraries/Main Library)', '/Libraries/Main Library/LW Shaders', 1);
WindowsManager.SnapFrameToFrameEx(LEFrameName, outlookFrameName, 10, 12, 0, 0);
WindowsManager.SetFrameOwnerFrame(outlookFrameName, LEFrameName);
}
catch (e) {};
dynLibName = Node.Create('Library Package/Library', LibParent);
Node.Copy('/Libraries/Context Library/LW Shader Bricks', dynLibName);
}
else
{
// scan for specific connectors to identify known objects
bShowD3D = false;
bShowLW = false;
// D3D material - ME2 flavor - check for connectors
if ((Node.ConExists(nodeName, '{8AC1B301-8385-462E-8D5F-1950BE149D23}') && //ME2Material
!Node.ConExists(nodeName, '{65769C74-E744-4543-9660-22F5E449574A}')) || // Mesh
Node.ConExists(nodeName, '{5604B7D0-101A-4ac0-8C69-16856C1010BE}') || //texcoord shader
Node.ConExists(nodeName, '{0118D796-532C-4080-B5D3-76C654C956CA}') || //normal shader
Node.ConExists(nodeName, '{D4A4CE71-AA49-4700-848A-FCFA47B949D5}') || //model shader
Node.ConExists(nodeName, '{E0328037-A867-4eeb-849D-588B8E5ED454}') || //vertexlight shader
Node.ConExists(nodeName, '{A202CC0A-0F8B-4bb7-A2A5-789BCF71141E}') || //light shader
Node.ConExists(nodeName, '{35CB95EA-444F-472e-AAE5-1157661B3514}') || //color shader
Node.ConExists(nodeName, '{531CB799-5EAF-4d13-937E-62AD0B14AA04}') || //alpha shader
Node.ConExists(nodeName, '{13EA6B04-00B9-4604-B783-96B65FB98EBD}') || //vertex shader
Node.ConDataTypeExists(nodeName, '{31DB0B46-352B-4e3f-B1EB-93E33E2FB512}') || //general brick connector
Node.ConDataTypeExists(nodeName, '{72D6357E-129E-4d13-B0DC-24634DADB16B}') || //light properties
Node.ConDataTypeExists(nodeName, '{E8A6C459-5B7E-4b44-AB0B-FC595E2994D8}') //compatible light
)
{
bShowD3D = true;
System.Trace('scanner : D3d (ME2 flavor) material detected');
}
// LW material - check for connectors
if (Node.ConExists(nodeName, '{0FEAB26E-C88B-4d6f-A16F-403B7A88BF1A}') || //alpha shader
Node.ConExists(nodeName, '{6B757841-E35E-4a2d-81E8-FD8117414D8D}') || //color shader
Node.ConExists(nodeName, '{B5389EEE-B106-40f6-A579-D864D0F81ECC}') || //model shader
Node.ConExists(nodeName, '{A06CE001-6F55-4c58-99B3-1675DA6F49D6}') || //normal shader
Node.ConDataTypeExists(nodeName, '{F3A64795-9A18-46ef-9CCC-F3F43A518982}') //general LW brick connector
)
{
bShowLW = true;
System.Trace('scanner : LW material detected');
}
// action part - update dynamic library content
if(bShowD3D || bShowLW)
{
//check if old library exists
if(oldLibName == '')
{
// create library node
dynLibName = Node.Create('Library Package/Library', LibParent);
if (bShowD3D)
{
//Node.Copy('/Libraries/Context Library/Shaders', dynLibName);
//Node.Copy('/Libraries/Context Library/Components', dynLibName);
Library.CreateContextLib('/Libraries/Context Library/Shaders', dynLibName);
Library.CreateContextLib('/Libraries/Context Library/Components', dynLibName);
}
if (bShowLW)
{
//Node.Copy('/Libraries/Context Library/LW Shader Bricks', dynLibName);
Library.CreateContextLib('/Libraries/Context Library/LW Shader Bricks', dynLibName);
}
}
else
{
// use old library
dynLibName = oldLibName;
}
}
}
if(dynLibName == '')
{
// if there is no dynamic library to open
// close toolbar and existing library (if any)
if(oldLibName != '')
{
WindowsManager.CloseWindow(ret.Param('Dynamic Lib WinID'));
Node.Delete(oldLibName);
// set output param
ret.Param('Dynamic Lib WinID') = '';
ret.Param('Lib Name') = '';
}
}
else
{
// check if already opened
if(oldLibName != '')
{
//WindowsManager.CloseWindow(ret.Param('Dynamic Lib WinID'));
}
else
{
// show the library, snap and set owner
frameID = Library.ShowLibraryEx(dynLibName, false);
WindowsManager.SnapFrameToFrameEx(LEFrameName, frameID, 11, 11, 0, 0);
WindowsManager.SetFrameOwnerFrame(frameID, LEFrameName);
// set output param
ret.Param('Dynamic Lib WinID') = frameID;
ret.Param('Lib Name') = dynLibName;
}
}
}
]]></SCRIPT_CODE>
</SCRIPT>